package com.dingup.homework.bean;


import com.dingup.homework.enums.QuestionTypeEnum;

/**
 * @author jun 2018/11/15
 */
public class HomeworkAnswerItem {
    private Integer index;
    private QuestionTypeEnum questionType;

    /**
     * 自定义主观题参数
     */
    private String docUrl;
    private String audioUrl;

    /**
     * 模考参数:  模考id
     */
    private String examId;
    private Integer id;

    private Integer totalNum;
    private Integer correctNum;
    private Integer wrongNum;
    private String correctRate;


    public HomeworkAnswerItem() {

    }

    public HomeworkAnswerItem(String docUrl, String audioUrl) {
        this.index = 1;
        this.questionType = QuestionTypeEnum.SUBJECTIVE;
        this.docUrl = docUrl;
        this.audioUrl = audioUrl;
    }

    public HomeworkAnswerItem(Integer index, QuestionTypeEnum questionType, Integer totalNum, Integer correctNum) {
        this.index = index;
        this.questionType = questionType;
        this.totalNum = totalNum;
        this.correctNum = correctNum;
        this.wrongNum = totalNum - correctNum;
        this.correctRate = (totalNum.equals(0) ? 0 : correctNum * 100 / totalNum) + " %";
    }

    public HomeworkAnswerItem(Integer index, QuestionTypeEnum questionType, Integer id, String examId, Integer totalNum, Integer correctNum) {
        this.index = index;
        this.id = id;
        this.questionType = questionType;
        this.examId = examId;
        this.totalNum = totalNum;
        this.correctNum = correctNum;
        this.wrongNum = totalNum - correctNum;
        this.correctRate = (totalNum.equals(0) ? 0 : correctNum * 100 / totalNum) + " %";
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    public QuestionTypeEnum getQuestionType() {
        return questionType;
    }

    public void setQuestionType(QuestionTypeEnum questionType) {
        this.questionType = questionType;
    }

    public String getDocUrl() {
        return docUrl;
    }

    public void setDocUrl(String docUrl) {
        this.docUrl = docUrl;
    }

    public String getAudioUrl() {
        return audioUrl;
    }

    public void setAudioUrl(String audioUrl) {
        this.audioUrl = audioUrl;
    }

    public String getExamId() {
        return examId;
    }

    public void setExamId(String examId) {
        this.examId = examId;
    }

    public Integer getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(Integer totalNum) {
        this.totalNum = totalNum;
    }

    public Integer getCorrectNum() {
        return correctNum;
    }

    public void setCorrectNum(Integer correctNum) {
        this.correctNum = correctNum;
    }

    public Integer getWrongNum() {
        return wrongNum;
    }

    public void setWrongNum(Integer wrongNum) {
        this.wrongNum = wrongNum;
    }

    public String getCorrectRate() {
        return correctRate;
    }

    public void setCorrectRate(String correctRate) {
        this.correctRate = correctRate;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
}
